import java.util.Scanner;//1462: 【入门】小明的游泳时间

public class Main1462 {
    public static void main(String[] args) {
        Scanner se = new Scanner(System.in);
        int a = se.nextInt();
        int b = se.nextInt();
        int c = se.nextInt();
        int d = se.nextInt();
        int t = a * 60 + b;
        int s = c * 60 + d;
        int r = s - t;
        System.out.println(r/60+" "+r%60);
    }
}
